package edu.xlh.travel.controller.admin;

import edu.xlh.travel.common.Result;
import edu.xlh.travel.pojo.querypojo.QueryCheckTask;
import edu.xlh.travel.service.CheckedTaskService;
import edu.xlh.travel.syslog.annontion.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.HashMap;

@Controller
@CrossOrigin
@RequestMapping("/checkedTask")
public class CheckedTaskController {

    @Autowired
    private CheckedTaskService checkedTaskService;

    @Log("跳转已审核任务列表页面")
    @RequestMapping("/checkedTaskList")
    public String checkedList() {
        return "admin/checkTaskmanage/checkedList";
    }

    @Log("已审核任务列表查询")
    @RequestMapping("/findAllCheckedTask")
    @ResponseBody
    public Result findAllCheckedTask(int page, int limit , HttpSession session) {
        return checkedTaskService.findAllCheckedTask(page , limit , session);
    }

    /*
     * query checkedTask by condition
     * */
    @Log("条件模糊查询已审核任务列表")
    @RequestMapping("/QueryCheckedTaskByCondition")
    @ResponseBody
    public Result  QueryCheckedTaskByCondition(Integer page, Integer limit, QueryCheckTask queryCheckingTask , HttpSession session) {
        return checkedTaskService.QueryCheckedTaskByCondition(page , limit ,queryCheckingTask , session);
    }

    /*
    * getCheckedTask by orderId
    * */
    @Log("根据订单号查询已审核任务")
    @RequestMapping("/getCheckedTaskByOrderId")
    @ResponseBody
    public Result getCheckedTaskByOrderId(@RequestBody HashMap<String ,Object> hashMap , HttpSession session) {
        return checkedTaskService.getCheckedTaskByOrderId(hashMap , session);
    }
}
